home *** CD-ROM | disk | FTP | other *** search
/ Aminet 43 / Aminet 43 (2001)(GTI - Schatztruhe)[!][Jun 2001].iso / Aminet / comm / mail / YAM22src.lha / YAM_CO.c < prev    next >
C/C++ Source or Header  |  2000-11-03  |  60KB  |  1,379 lines

  1. /***************************************************************************
  2.  
  3.  YAM - Yet Another Mailer
  4.  Copyright (C) 2000  Marcel Beck <mbeck@yam.ch>
  5.  
  6.  This program is free software; you can redistribute it and/or modify
  7.  it under the terms of the GNU General Public License as published by
  8.  the Free Software Foundation; either version 2 of the License, or
  9.  (at your option) any later version.
  10.  
  11.  This program is distributed in the hope that it will be useful,
  12.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  GNU General Public License for more details.
  15.  
  16.  You should have received a copy of the GNU General Public License
  17.  along with this program; if not, write to the Free Software
  18.  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19.  
  20.  YAM Official Support Site :  http://www.yam.ch
  21.  YAM OpenSource project    :  http://sourceforge.net/projects/yamos/
  22.  
  23. ***************************************************************************/
  24.  
  25. #include "YAM.h"
  26.  
  27. /***************************************************************************
  28.  Module: Configuration
  29. ***************************************************************************/
  30.  
  31. /// CO_NewPrefsFile
  32. //  Sets the name of the configuration file
  33. void CO_NewPrefsFile(char *fname)
  34. {
  35.    static char wtitle[SIZE_SMALL+SIZE_PATHFILE];
  36.    strcpy(G->CO_PrefsFile, fname);
  37.    sprintf(wtitle, "%s (%s)", GetStr(MSG_MA_MConfig), fname);
  38.    set(G->CO->GUI.WI, MUIA_Window_Title, wtitle);
  39. }
  40. ///
  41.  
  42. /**** Rules ****/
  43. /// CO_NewRule
  44. //  Initializes a new rule
  45. struct Rule *CO_NewRule(void)
  46. {
  47.    struct Rule *rule;
  48.    if (rule = calloc(1,sizeof(struct Rule)))
  49.    {
  50.       strcpy(rule->Name, GetStr(MSG_NewEntry));
  51.       rule->ApplyToNew = rule->ApplyOnReq = TRUE;
  52.    }
  53.    return rule;
  54. }
  55. ///
  56. /// CO_AddRule
  57. //  Adds a new entry to the rule list
  58. SAVEDS void CO_AddRule(void)
  59. {
  60.    int i, m, s;
  61.    for (i = 0; i < MAXRU; i++)
  62.       if (!CE->RU[i])
  63.       {
  64.          CE->RU[i] = CO_NewRule();
  65.          for (s = 0; s < 4; s++) for (m = 0; m < 5; m++)
  66.          {
  67.             struct SearchGroup *sg = &(G->CO->GUI.GR_SEARCH[s]);
  68.             nnset(sg->CY_COMP[m], MUIA_Cycle_Active, 0);
  69.             if (sg->ST_MATCH[m]) nnset(sg->ST_MATCH[m], MUIA_String_Contents, "");
  70.             else nnset(sg->CY_STATUS, MUIA_Cycle_Active, 0);
  71.             if (sg->CH_CASESENS[m]) nnset(sg->CH_CASESENS[m], MUIA_Selected, FALSE);
  72.             if (sg->CH_SUBSTR[m]) nnset(sg->CH_SUBSTR[m], MUIA_Selected, FALSE);
  73.          }
  74.          DoMethod(G->CO->GUI.LV_RULES, MUIM_List_InsertSingle, CE->RU[i], MUIV_List_Insert_Bottom);
  75.          set(G->CO->GUI.LV_RULES, MUIA_List_Active, i);
  76.          break; 
  77.       }
  78. }
  79. MakeHook(CO_AddRuleHook,CO_AddRule);
  80. ///
  81. /// CO_DelRule
  82. //  Deletes an entry from the rule list
  83. SAVEDS void CO_DelRule(void)
  84. {
  85.    int i, p;
  86.    get(G->CO->GUI.LV_RULES, MUIA_List_Active, &p);
  87.    if (p != MUIV_List_Active_Off)
  88.    {
  89.       DoMethod(G->CO->GUI.LV_RULES, MUIM_List_Remove, p);
  90.       for (i = p+1; i < MAXRU; i++) CE->RU[i-1] = CE->RU[i];
  91.       CE->RU[i-1] = 0;
  92.    }
  93. }
  94. MakeHook(CO_DelRuleHook,CO_DelRule);
  95. ///
  96. /// CO_RuleGhost
  97. //  Enables/disables gadgets in rule form
  98. void CO_RuleGhost(struct CO_GUIData *gui, struct Rule *ru)
  99. {
  100.    BOOL isremote = FALSE, single = FALSE;
  101.  
  102.    if (ru) { isremote = ru->Remote; single = !ru->Combine; }
  103.    set(gui->ST_RNAME, MUIA_Disabled, !ru);
  104.    set(gui->CH_REMOTE, MUIA_Disabled, !ru);
  105.    set(gui->CH_APPLYNEW, MUIA_Disabled, !ru || isremote);
  106.    set(gui->CH_APPLYREQ, MUIA_Disabled, !ru || isremote);
  107.    set(gui->CH_APPLYSENT, MUIA_Disabled, !ru || isremote);
  108.    set(gui->CY_COMBINE[isremote], MUIA_Disabled, !ru);
  109.    set(gui->CH_ABOUNCE, MUIA_Disabled, !ru || isremote);
  110.    set(gui->CH_AFORWARD, MUIA_Disabled, !ru || isremote);
  111.    set(gui->CH_ARESPONSE, MUIA_Disabled, !ru || isremote);
  112.    set(gui->CH_AEXECUTE, MUIA_Disabled, !ru);
  113.    set(gui->CH_APLAY, MUIA_Disabled, !ru);
  114.    set(gui->CH_AMOVE, MUIA_Disabled, !ru || isremote);
  115.    set(gui->CH_ADELETE, MUIA_Disabled, !ru);
  116.    set(gui->CH_ASKIP, MUIA_Disabled, !ru || !isremote);
  117.    set(gui->ST_ABOUNCE, MUIA_Disabled, !ru);
  118.    set(gui->ST_AFORWARD, MUIA_Disabled, !ru);
  119.    set(gui->ST_ARESPONSE, MUIA_Disabled, !ru);
  120.    set(gui->ST_AEXECUTE, MUIA_Disabled, !ru);
  121.    set(gui->ST_APLAY, MUIA_Disabled, !ru);
  122.    set(gui->TX_MOVETO, MUIA_Disabled, !ru);
  123.    set(gui->BT_RDEL, MUIA_Disabled, !ru);
  124.    FI_SearchGhost(&(gui->GR_SEARCH[2*isremote]), !ru);
  125.    FI_SearchGhost(&(gui->GR_SEARCH[2*isremote+1]), !ru || single);
  126.  
  127. }
  128. ///
  129. /// CO_GetRUEntry
  130. //  Fills form with data from selected list entry
  131. SAVEDS void CO_GetRUEntry(void)
  132. {
  133.    struct Rule *rule = NULL;
  134.    struct CO_GUIData *gui = &G->CO->GUI;
  135.  
  136.    DoMethod(gui->LV_RULES, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &rule);
  137.    if (rule)
  138.    {      
  139.       int m, i, k, rm = rule->Remote ? 1 : 0;
  140.       nnset(gui->ST_RNAME,    MUIA_String_Contents, rule->Name);
  141.       nnset(gui->CH_REMOTE,   MUIA_Selected, rm);
  142.       nnset(gui->CH_APPLYNEW, MUIA_Selected, rule->ApplyToNew);
  143.       nnset(gui->CH_APPLYSENT,MUIA_Selected, rule->ApplyToSent);
  144.       nnset(gui->CH_APPLYREQ, MUIA_Selected, rule->ApplyOnReq);
  145.       nnset(gui->CY_COMBINE[rm],MUIA_Cycle_Active, rule->Combine);
  146.       nnset(gui->CH_ABOUNCE,   MUIA_Selected, (rule->Actions&  1)==  1);
  147.       nnset(gui->CH_AFORWARD,  MUIA_Selected, (rule->Actions&  2)==  2);
  148.       nnset(gui->CH_ARESPONSE, MUIA_Selected, (rule->Actions&  4)==  4);
  149.       nnset(gui->CH_AEXECUTE,  MUIA_Selected, (rule->Actions&  8)==  8);
  150.       nnset(gui->CH_APLAY,     MUIA_Selected, (rule->Actions& 16)== 16);
  151.       nnset(gui->CH_AMOVE,     MUIA_Selected, (rule->Actions& 32)== 32);
  152.       nnset(gui->CH_ADELETE,   MUIA_Selected, (rule->Actions& 64)== 64);
  153.       nnset(gui->CH_ASKIP,     MUIA_Selected, (rule->Actions&128)==128);
  154.       nnset(gui->ST_ABOUNCE   ,MUIA_String_Contents, rule->BounceTo);
  155.       nnset(gui->ST_AFORWARD  ,MUIA_String_Contents, rule->ForwardTo);
  156.       nnset(gui->ST_ARESPONSE ,MUIA_String_Contents, rule->ReplyFile);
  157.       nnset(gui->ST_AEXECUTE  ,MUIA_String_Contents, rule->ExecuteCmd);
  158.       nnset(gui->ST_APLAY     ,MUIA_String_Contents, rule->PlaySound);
  159.       nnset(gui->TX_MOVETO    ,MUIA_Text_Contents, rule->MoveTo);
  160.       set(gui->GR_LRGROUP, MUIA_Group_ActivePage, rm);
  161.       for (i = 0; i < 2; i++)
  162.       {
  163.          struct SearchGroup *sg = &(gui->GR_SEARCH[i+2*rm]);
  164.          nnset(sg->CY_MODE       ,MUIA_Cycle_Active, rule->Field[i]);
  165.          nnset(sg->RA_ADRMODE    ,MUIA_Radio_Active, rule->SubField[i]);
  166.          nnset(sg->ST_FIELD      ,MUIA_String_Contents, rule->CustomField[i]);
  167.          nnset(sg->PG_SRCHOPT    ,MUIA_Group_ActivePage, m = Mode2Group[rule->Field[i]]);
  168.          nnset(sg->CY_COMP[m], MUIA_Cycle_Active, rule->Comparison[i]);
  169.          if (sg->ST_MATCH[m]) nnset(sg->ST_MATCH[m], MUIA_String_Contents, rule->Match[i]);
  170.          else for (k = 0; k < 8; k++) if (!stricmp(rule->Match[i], Status[k])) nnset(sg->CY_STATUS, MUIA_Cycle_Active, k);
  171.          if (sg->CH_CASESENS[m]) nnset(sg->CH_CASESENS[m], MUIA_Selected, rule->CaseSens[i]);
  172.          if (sg->CH_SUBSTR[m]) nnset(sg->CH_SUBSTR[m], MUIA_Selected, rule->Substring[i]);
  173.       }
  174.    }
  175.    CO_RuleGhost(gui, rule);
  176. }
  177. MakeHook(CO_GetRUEntryHook,CO_GetRUEntry);
  178. ///
  179. /// CO_PutRUEntry
  180. //  Fills form data into selected list entry
  181. SAVEDS void CO_PutRUEntry(void)
  182. {
  183.    struct Rule *rule = NULL;
  184.    struct CO_GUIData *gui = &G->CO->GUI;
  185.    char *tx;
  186.  
  187.    DoMethod(gui->LV_RULES, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &rule);
  188.    if (rule)
  189.    {
  190.       int i, m, rm = GetMUICheck(gui->CH_REMOTE);
  191.       
  192.       GetMUIString(rule->Name, gui->ST_RNAME);
  193.       rule->Remote = rm == 1;
  194.       rule->ApplyToNew  = GetMUICheck(gui->CH_APPLYNEW);
  195.       rule->ApplyToSent = GetMUICheck(gui->CH_APPLYSENT);
  196.       rule->ApplyOnReq  = GetMUICheck(gui->CH_APPLYREQ);
  197.       rule->Combine     = GetMUICycle(gui->CY_COMBINE[rm]);
  198.       rule->Actions = 0;
  199.       if (GetMUICheck(gui->CH_ABOUNCE))    rule->Actions |= 1;
  200.       if (GetMUICheck(gui->CH_AFORWARD))   rule->Actions |= 2;
  201.       if (GetMUICheck(gui->CH_ARESPONSE))  rule->Actions |= 4;
  202.       if (GetMUICheck(gui->CH_AEXECUTE))   rule->Actions |= 8;
  203.       if (GetMUICheck(gui->CH_APLAY))      rule->Actions |= 16;
  204.       if (GetMUICheck(gui->CH_AMOVE))      rule->Actions |= 32;
  205.       if (GetMUICheck(gui->CH_ADELETE))    rule->Actions |= 64;
  206.       if (GetMUICheck(gui->CH_ASKIP))      rule->Actions |= 128;
  207.       GetMUIString(rule->BounceTo,   gui->ST_ABOUNCE);
  208.       GetMUIString(rule->ForwardTo , gui->ST_AFORWARD);
  209.       GetMUIString(rule->ReplyFile , gui->ST_ARESPONSE);
  210.       GetMUIString(rule->ExecuteCmd, gui->ST_AEXECUTE);
  211.       GetMUIString(rule->PlaySound,  gui->ST_APLAY);
  212.       get(gui->TX_MOVETO, MUIA_Text_Contents, &tx); strcpy(rule->MoveTo, tx);
  213.       for (i = 0; i < 2; i++)
  214.       {
  215.          struct SearchGroup *sg = &(gui->GR_SEARCH[i+2*rm]);
  216.          get(sg->PG_SRCHOPT, MUIA_Group_ActivePage, &m);
  217.          rule->Field[i]      = GetMUICycle(sg->CY_MODE);
  218.          rule->SubField[i]   = GetMUIRadio(sg->RA_ADRMODE);
  219.          GetMUIString(rule->CustomField[i], sg->ST_FIELD);
  220.          rule->Comparison[i] = GetMUICycle(sg->CY_COMP[m]);
  221.          if (sg->ST_MATCH[m]   ) GetMUIString(rule->Match[i], sg->ST_MATCH[m]);
  222.                            else  strcpy(rule->Match[i], Status[GetMUICycle(sg->CY_STATUS)]);
  223.         if (sg->CH_CASESENS[m]) rule->CaseSens[i]  = GetMUICheck(sg->CH_CASESENS[m]);
  224.         if (sg->CH_SUBSTR[m]  ) rule->Substring[i] = GetMUICheck(sg->CH_SUBSTR[m]);
  225.       }
  226.       CO_RuleGhost(gui, rule);
  227.       DoMethod(gui->LV_RULES, MUIM_List_Redraw, MUIV_List_Redraw_Active);
  228.    }
  229. }
  230. MakeHook(CO_PutRUEntryHook,CO_PutRUEntry);
  231. ///
  232. /// CO_RemoteToggleFunc
  233. //  Enables/disables GUI elements for remote filters
  234. SAVEDS ASM void CO_RemoteToggleFunc(REG(a1) int *arg)
  235. {
  236.    BOOL rm = *arg;
  237.    struct CO_GUIData *gui = &G->CO->GUI;
  238.    struct SearchGroup *src, *dst;
  239.    int i, m;
  240.  
  241.    set(gui->GR_LRGROUP, MUIA_Group_ActivePage, rm);
  242.    nnset(gui->CY_COMBINE[rm], MUIA_Cycle_Active, GetMUICycle(gui->CY_COMBINE[!rm]));
  243.    for (i = 0; i < 2; i++)
  244.    {
  245.       src = &(gui->GR_SEARCH[i+2*(!rm)]); dst = &(gui->GR_SEARCH[i+2*rm]);
  246.       nnset(dst->CY_MODE, MUIA_Cycle_Active, GetMUICycle(src->CY_MODE));
  247.       nnset(dst->RA_ADRMODE, MUIA_Radio_Active, GetMUIRadio(src->RA_ADRMODE));
  248.       nnset(dst->ST_FIELD, MUIA_String_Contents, GetMUIStringPtr(src->ST_FIELD));
  249.       for (m = 0; m < 5; m++)
  250.       {
  251.          nnset(dst->CY_COMP[m], MUIA_Cycle_Active, GetMUICycle(src->CY_COMP[m]));
  252.          if (src->ST_MATCH[m]) nnset(dst->ST_MATCH[m], MUIA_String_Contents, GetMUIStringPtr(src->ST_MATCH[m]));
  253.                           else nnset(dst->CY_STATUS, MUIA_Cycle_Active, GetMUICycle(src->CY_STATUS));
  254.          if (src->CH_CASESENS[m]) nnset(dst->CH_CASESENS[m], MUIA_Selected, GetMUICheck(src->CH_CASESENS[m]));
  255.          if (src->CH_SUBSTR[m]  ) nnset(dst->CH_SUBSTR[m]  , MUIA_Selected, GetMUICheck(src->CH_SUBSTR[m]));
  256.       }
  257.    }
  258.    CO_PutRUEntry();
  259. }
  260. MakeHook(CO_RemoteToggleHook,CO_RemoteToggleFunc);
  261. ///
  262.  
  263. /**** POP3 servers ****/
  264. /// CO_NewPOP3
  265. //  Initializes a new POP3 account
  266. struct POP3 *CO_NewPOP3(struct Config *co, BOOL first)
  267. {
  268.    struct POP3 *pop3;
  269.    if (pop3 = calloc(1, sizeof(struct POP3)))
  270.    {
  271.       if (first)
  272.       {
  273.          char *p, buffer[SIZE_USERID];
  274.          stccpy(buffer, co->EmailAddress, SIZE_USERID);
  275.          if (p = strchr(buffer, '@')) *p = 0;
  276.          strcpy(pop3->User, buffer);
  277.          strcpy(pop3->Server, co->SMTP_Server);
  278.       }
  279.       pop3->Enabled = TRUE;
  280.       pop3->DeleteOnServer = TRUE;
  281.    }
  282.    return pop3;
  283. }
  284. ///
  285. /// CO_AddPOP3
  286. //  Adds a new entry to the POP3 account list
  287. SAVEDS void CO_AddPOP3(void)
  288. {
  289.    int i;
  290.    for (i = 0; i < MAXP3; i++)
  291.       if (!CE->P3[i])
  292.       {
  293.          CE->P3[i] = CO_NewPOP3(CE, i == 0);
  294.          DoMethod(G->CO->GUI.LV_POP3, MUIM_List_InsertSingle, CE->P3[i], MUIV_List_Insert_Bottom);
  295.          set(G->CO->GUI.LV_POP3, MUIA_List_Active, i);
  296.          set(G->CO->GUI.WI, MUIA_Window_ActiveObject, G->CO->GUI.ST_POPHOST);
  297.          break; 
  298.       }
  299. }
  300. MakeHook(CO_AddPOP3Hook,CO_AddPOP3);
  301. ///
  302. /// CO_DelPOP3
  303. //  Deletes an entry from the POP3 account list
  304. SAVEDS void CO_DelPOP3(void)
  305. {
  306.    int i, p, e;
  307.    struct CO_GUIData *gui = &G->CO->GUI;
  308.  
  309.    get(gui->LV_POP3, MUIA_List_Active, &p);
  310.    get(gui->LV_POP3, MUIA_List_Entries, &e);
  311.    if (p != MUIV_List_Active_Off && e > 1)
  312.    {
  313.       DoMethod(gui->LV_POP3, MUIM_List_Remove, p);
  314.       for (i = p+1; i < MAXP3; i++) CE->P3[i-1] = CE->P3[i];
  315.       CE->P3[i-1] = NULL;
  316.    }
  317. }
  318. MakeHook(CO_DelPOP3Hook,CO_DelPOP3);
  319. ///
  320. /// CO_GetP3Entry
  321. //  Fills form with data from selected list entry
  322. SAVEDS void CO_GetP3Entry(void)
  323. {
  324.    int e;
  325.    struct POP3 *pop3 = NULL;
  326.    struct CO_GUIData *gui = &G->CO->GUI;
  327.  
  328.    DoMethod(gui->LV_POP3, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &pop3);
  329.    if (pop3)
  330.    {
  331.       nnset(gui->ST_POPHOST,   MUIA_String_Contents, pop3->Server);
  332.       nnset(gui->ST_POPUSERID, MUIA_String_Contents, pop3->User);
  333.       nnset(gui->ST_PASSWD,    MUIA_String_Contents, pop3->Password);
  334.       nnset(gui->CH_POPENABLED,MUIA_Selected, pop3->Enabled);
  335.       nnset(gui->CH_USEAPOP,   MUIA_Selected, pop3->UseAPOP);
  336.       nnset(gui->CH_DELETE,    MUIA_Selected, pop3->DeleteOnServer);
  337.    }
  338.    get(gui->LV_POP3, MUIA_List_Entries, &e);
  339.    set(gui->GR_POP3, MUIA_Disabled, !pop3);
  340.    set(gui->BT_PDEL, MUIA_Disabled, !pop3 || e < 2);
  341. }
  342. MakeHook(CO_GetP3EntryHook,CO_GetP3Entry);
  343. ///
  344. /// CO_PutP3Entry
  345. //  Fills form data into selected list entry
  346. SAVEDS void CO_PutP3Entry(void)
  347. {
  348.    struct POP3 *pop3 = NULL;
  349.    struct CO_GUIData *gui = &G->CO->GUI;
  350.    int p;
  351.  
  352.    get(gui->LV_POP3, MUIA_List_Active, &p);
  353.    if (p != MUIV_List_Active_Off)
  354.    {
  355.       DoMethod(gui->LV_POP3, MUIM_List_GetEntry, p, &pop3);
  356.       GetMUIString(pop3->Server, gui->ST_POPHOST);
  357.       GetMUIString(pop3->User, gui->ST_POPUSERID);
  358.       GetMUIString(pop3->Password, gui->ST_PASSWD);
  359.       pop3->Enabled        = GetMUICheck(gui->CH_POPENABLED);
  360.       pop3->UseAPOP        = GetMUICheck(gui->CH_USEAPOP);
  361.       pop3->DeleteOnServer = GetMUICheck(gui->CH_DELETE);
  362.       sprintf(pop3->Account, "%s@%s", pop3->User, pop3->Server);
  363.       DoMethod(gui->LV_POP3, MUIM_List_Redraw, p);
  364.    }
  365. }
  366. MakeHook(CO_PutP3EntryHook,CO_PutP3Entry);
  367. ///
  368. /// CO_GetDefaultPOPFunc
  369. //  Sets values of first POP3 account
  370. SAVEDS void CO_GetDefaultPOPFunc(void)
  371. {
  372.    struct POP3 *pop3 = CE->P3[0];
  373.  
  374.    if (!pop3) return;
  375.    GetMUIString(pop3->Server, G->CO->GUI.ST_POPHOST0);
  376.    GetMUIString(pop3->Password, G->CO->GUI.ST_PASSWD0);
  377.    sprintf(pop3->Account, "%s@%s", pop3->User, pop3->Server);
  378. }
  379. MakeHook(CO_GetDefaultPOPHook,CO_GetDefaultPOPFunc);
  380. ///
  381.  
  382. /**** Mime Viewers ****/
  383. /// CO_NewMimeView
  384. //  Initializes a new MIME viewer
  385. struct MimeView *CO_NewMimeView(void)
  386. {
  387.    struct MimeView *mv;
  388.    if (mv = calloc(1, sizeof(struct MimeView)))
  389.    {
  390.       stccpy(mv->ContentType, "?/?", SIZE_CTYPE);
  391.    }
  392.    return mv;
  393. }
  394. ///
  395. /// CO_AddMimeView
  396. //  Adds a new entry to the MIME viewer list
  397. SAVEDS void CO_AddMimeView(void)
  398. {
  399.    struct CO_GUIData *gui = &G->CO->GUI;
  400.    int i;
  401.    for (i = 0; i < MAXMV; i++)
  402.       if (!CE->MV[i])
  403.       {
  404.          CE->MV[i] = CO_NewMimeView();
  405.          DoMethod(gui->LV_MIME, MUIM_List_InsertSingle, CE->MV[i], MUIV_List_Insert_Bottom);
  406.          set(gui->LV_MIME, MUIA_List_Active, MUIV_List_Active_Bottom);
  407.          set(gui->WI, MUIA_Window_ActiveObject, gui->ST_CTYPE);
  408.          break; 
  409.       }
  410. }
  411. MakeHook(CO_AddMimeViewHook,CO_AddMimeView);
  412. ///
  413. /// CO_DelMimeView
  414. //  Deletes an entry from the MIME viewer list
  415. SAVEDS void CO_DelMimeView(void)
  416. {
  417.    int i, p;
  418.    get(G->CO->GUI.LV_MIME, MUIA_List_Active, &p);
  419.    if (p != MUIV_List_Active_Off)
  420.    {
  421.       DoMethod(G->CO->GUI.LV_MIME, MUIM_List_Remove, p);
  422.       for (i = p+1; i < MAXMV-1; i++) CE->MV[i] = CE->MV[i+1];
  423.       CE->MV[i] = 0;
  424.    }
  425. }
  426. MakeHook(CO_DelMimeViewHook,CO_DelMimeView);
  427. ///
  428. /// CO_GetMVEntry
  429. //  Fills form with data from selected list entry
  430. SAVEDS void CO_GetMVEntry(void)
  431. {
  432.    struct MimeView *mv = NULL;
  433.    struct CO_GUIData *gui = &G->CO->GUI;
  434.    int act = 0;
  435.  
  436.    DoMethod(gui->LV_MIME, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &mv);
  437.    if (mv)
  438.    {
  439.       nnset(gui->ST_CTYPE, MUIA_String_Contents, mv->ContentType);
  440.       nnset(gui->ST_EXTENS, MUIA_String_Contents, mv->Extension);
  441.       nnset(gui->ST_COMMAND, MUIA_String_Contents, mv->Command);
  442.       get(gui->LV_MIME, MUIA_List_Active, &act);
  443.    }
  444.    set(gui->GR_MIME, MUIA_Disabled, !mv);
  445.    set(gui->BT_MDEL, MUIA_Disabled, !mv);
  446. }
  447. MakeHook(CO_GetMVEntryHook,CO_GetMVEntry);
  448. ///
  449. /// CO_PutMVEntry
  450. //  Fills form data into selected list entry
  451. SAVEDS void CO_PutMVEntry(void)
  452. {
  453.    struct MimeView *mv = NULL;
  454.    struct CO_GUIData *gui = &G->CO->GUI;
  455.  
  456.    DoMethod(gui->LV_MIME, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &mv);
  457.    if (mv)
  458.    {
  459.       GetMUIString(mv->ContentType, gui->ST_CTYPE);
  460.       GetMUIString(mv->Extension, gui->ST_EXTENS);
  461.       GetMUIString(mv->Command, gui->ST_COMMAND);
  462.       DoMethod(gui->LV_MIME, MUIM_List_Redraw, MUIV_List_Redraw_Active);
  463.    }
  464. }
  465. MakeHook(CO_PutMVEntryHook,CO_PutMVEntry);
  466. ///
  467.  
  468. /**** ARexx Hooks ****/
  469. /// CO_GetRXEntry
  470. //  Fills form with data from selected list entry
  471. SAVEDS void CO_GetRXEntry(void)
  472. {
  473.    int act;
  474.    struct CO_GUIData *gui = &G->CO->GUI;
  475.    struct RxHook *rh;
  476.    get(gui->LV_REXX, MUIA_List_Active, &act);
  477.    rh = &(CE->RX[act]);
  478.    nnset(gui->ST_RXNAME, MUIA_String_Contents, act < 10 ? rh->Name : "");
  479.    nnset(gui->ST_SCRIPT, MUIA_String_Contents, rh->Script);
  480.    nnset(gui->CY_ISADOS, MUIA_Cycle_Active, rh->IsAmigaDOS ? 1 : 0);
  481.    nnset(gui->CH_CONSOLE, MUIA_Selected, rh->UseConsole);
  482.    nnset(gui->CH_WAITTERM, MUIA_Selected, rh->WaitTerm);
  483.    set(gui->ST_RXNAME, MUIA_Disabled, act >= 10);
  484.    DoMethod(gui->LV_REXX, MUIM_List_Redraw, act);
  485. }
  486. MakeHook(CO_GetRXEntryHook,CO_GetRXEntry);
  487. ///
  488. /// CO_PutRXEntry
  489. //  Fills form data into selected list entry
  490. SAVEDS void CO_PutRXEntry(void)
  491. {
  492.    int act;
  493.    struct CO_GUIData *gui = &G->CO->GUI;
  494.    get(gui->LV_REXX, MUIA_List_Active, &act);
  495.    if (act != MUIV_List_Active_Off)
  496.    {
  497.       struct RxHook *rh = &(CE->RX[act]);
  498.       GetMUIString(rh->Name, gui->ST_RXNAME);
  499.       GetMUIString(rh->Script, gui->ST_SCRIPT);
  500.       rh->IsAmigaDOS = GetMUICycle(gui->CY_ISADOS) == 1;
  501.       rh->UseConsole = GetMUICheck(gui->CH_CONSOLE);
  502.       rh->WaitTerm = GetMUICheck(gui->CH_WAITTERM);
  503.    }
  504. }
  505. MakeHook(CO_PutRXEntryHook,CO_PutRXEntry);
  506. ///
  507.  
  508. /// CO_IsValid
  509. //  Verifies if the required settings have been made
  510. BOOL CO_IsValid(void)
  511. {
  512.    if (G->CO_Valid) return TRUE;
  513.    if (G->CO) set(G->CO->GUI.WI,MUIA_Window_Open,TRUE);
  514.    else DoMethod(G->App, MUIM_CallHook, &CO_OpenHook);
  515.    MUI_Request(G->App, G->MA->GUI.WI, 0, NULL, GetStr(MSG_OkayReq), GetStr(MSG_CO_InvalidConf));
  516.    return FALSE;
  517. }
  518. ///
  519. /// CO_DetectPGP
  520. //  Checks if PGP 2 or 5 is available
  521. int CO_DetectPGP(struct Config *co)
  522. {
  523.    if (PFExists(co->PGPCmdPath, "pgpe")) return 5;
  524.    else if (PFExists(co->PGPCmdPath, "pgp")) return 2;
  525.    return 0;
  526. }
  527. ///
  528. /// CO_FreeConfig
  529. //  Deallocates a configuration structure
  530. void CO_FreeConfig(struct Config *co)
  531. {
  532.    int i;
  533.    for (i = 0; i < MAXP3; i++) if (co->P3[i]) free(co->P3[i]);
  534.    for (i = 0; i < MAXRU; i++) if (co->RU[i]) free(co->RU[i]);
  535.    for (i = 0; i < MAXMV; i++) if (co->MV[i]) free(co->MV[i]);
  536.    clear(co, sizeof(struct Config));
  537. }  
  538. ///
  539. /// CO_SetDefaults
  540. //  Sets configuration (or a part of it) to the factory settings
  541. void CO_SetDefaults(struct Config *co, int page)
  542. {
  543.    int i;
  544.    
  545.    if (page == 0 || page < 0)
  546.    {
  547.       *co->RealName = *co->EmailAddress = 0;
  548.       co->TimeZone = G->Locale ? -G->Locale->loc_GMTOffset/60 : 0;
  549.       co->DaylightSaving = 0;
  550.    }
  551.    if (page == 1 || page < 0)
  552.    {
  553.       for (i = 0; i < MAXP3; i++) { if (co->P3[i]) free(co->P3[i]); co->P3[i] = NULL; }
  554.       *co->SMTP_Server = *co->SMTP_Domain = 0;
  555.       co->Allow8bit = FALSE;
  556.       co->P3[0] = CO_NewPOP3(co, TRUE); co->P3[0]->DeleteOnServer = TRUE;
  557.    }
  558.    if (page == 2 || page < 0)
  559.    {
  560.       co->AvoidDuplicates = FALSE;
  561.       co->TransferWindow = 2;
  562.       co->UpdateStatus = co->DownloadLarge = TRUE;
  563.       co->PreSelection = 1;
  564.       co->WarnSize = 100;
  565.       co->CheckMailDelay = 0;
  566.       co->NotifyType = 1;
  567.       *co->NotifySound = *co->NotifyCommand = 0;
  568.    }
  569.    if (page == 3 || page < 0)
  570.    {
  571.       for (i = 0; i < MAXRU; i++) { if (co->RU[i]) free(co->RU[i]); co->RU[i] = NULL; }
  572.    }
  573.    if (page == 4 || page < 0)
  574.    {
  575.       for (i = 0; i < MAXMV; i++) { if (co->MV[i]) free(co->MV[i]); co->MV[i] = NULL; }
  576.       co->ShowHeader = 1;
  577.       strcpy(co->ShortHeaders,"(From|To|Date|Subject)");
  578.       co->ShowSenderInfo = 2;
  579.       strcpy(co->ColoredText.buf, "m6");
  580.       strcpy(co->Color2ndLevel.buf, "m7");
  581.       co->DisplayAllTexts = co->FixedFontEdit = co->UseTextstyles = TRUE;
  582.       co->WrapHeader = co->MultipleWindows = FALSE;
  583.       co->SigSepLine = 2;
  584.       *co->TranslationIn = 0;
  585.    }
  586.    if (page == 5 || page < 0)
  587.    {
  588.       *co->ReplyTo = *co->Organization = *co->ExtraHeaders = *co->TranslationOut = 0;
  589.       strcpy(co->NewIntro, GetStr(MSG_CO_NewIntroDef));
  590.       strcpy(co->Greetings, GetStr(MSG_CO_GreetingsDef));
  591.       co->EdWrapCol = 76;
  592.       co->EdWrapMode = 2;
  593.       strcpy(co->Editor, "C:Ed");
  594.       co->LaunchAlways = FALSE;
  595.    }
  596.    if (page == 6 || page < 0)
  597.    {
  598.       strcpy(co->ReplyHello, "Hello %f\\n");
  599.       strcpy(co->ReplyIntro, "On %d, you wrote:\\n");
  600.       strcpy(co->ReplyBye, "Regards");
  601.       strcpy(co->AltReplyHello, GetStr(MSG_CO_AltRepHelloDef));
  602.       strcpy(co->AltReplyIntro, GetStr(MSG_CO_AltRepIntroDef));
  603.       strcpy(co->AltReplyBye, GetStr(MSG_CO_AltRepByeDef));
  604.       strcpy(co->AltReplyPattern, GetStr(MSG_CO_AltRepPatternDef));
  605.       strcpy(co->MLReplyHello, GetStr(MSG_CO_MLRepHelloDef));
  606.       strcpy(co->MLReplyIntro, GetStr(MSG_CO_MLRepIntroDef));
  607.       strcpy(co->MLReplyBye, GetStr(MSG_CO_MLRepByeDef));
  608.       strcpy(co->ForwardIntro, GetStr(MSG_CO_ForwardIntroDef));
  609.       strcpy(co->ForwardFinish, GetStr(MSG_CO_ForwardFinishDef));
  610.       co->QuoteMessage = co->QuoteEmptyLines = co->CompareAddress = co->StripSignature = TRUE;
  611.       strcpy(co->QuoteText, ">");
  612.    }
  613.    if (page == 7 || page < 0)
  614.    {
  615.       co->UseSignature = FALSE;
  616.       strmfp(co->TagsFile, G->ProgDir, ".taglines");
  617.       strcpy(co->TagsSeparator, "%%");
  618.    }
  619.    if (page == 8 || page < 0)
  620.    {
  621.       co->FolderCols = 1+2+16;
  622.       co->MessageCols = 1+2+8+16;      
  623.       co->FixedFontList = C->SwatchBeat = FALSE;
  624.    }
  625.    if (page == 9 || page < 0)
  626.    {
  627.       G->PGPVersion = 0;
  628.       if (GetVar("PGPPATH", co->PGPCmdPath, SIZE_PATH, 0) >= 0) G->PGPVersion = CO_DetectPGP(co);
  629.       if (!G->PGPVersion)
  630.       {
  631.          strcpy(co->PGPCmdPath, "C:");
  632.          G->PGPVersion = CO_DetectPGP(co);
  633.       }
  634.       *co->MyPGPID = 0;
  635.       co->EncryptToSelf = co->LogAllEvents = TRUE;
  636.       strcpy(co->ReMailer, "Remailer <remailer@replay.com>");
  637.       strcpy(co->RMCommands, "Anon-to: %s");
  638.       strcpy(co->LogfilePath, G->ProgDir);
  639.       co->LogfileMode = 1;
  640.       co->SplitLogfile = FALSE;
  641.    }
  642.    if (page == 10 || page < 0)
  643.    {
  644.       co->GetOnStartup = co->SendOnStartup = co->LoadAllFolders = co->SendOnQuit = FALSE;
  645.       co->CleanupOnStartup = co->RemoveOnStartup = FALSE;
  646.       co->UpdateNewMail = co->CheckBirthdates = co->CleanupOnQuit = co->RemoveOnQuit = TRUE;
  647.    }
  648.    if (page == 11 || page < 0)
  649.    {
  650.       co->MV[0] = CO_NewMimeView();
  651.       strcpy(co->MV[0]->ContentType, GetStr(MSG_Default));
  652.       strcpy(co->MV[0]->Command, "SYS:Utilities/Multiview \"%s\"");
  653.       co->IdentifyBin = TRUE;
  654.       strcpy(co->DetachDir, "RAM:");
  655.       strcpy(co->AttachDir, "RAM:");
  656.    }
  657.    if (page == 12 || page < 0)
  658.    {
  659.       strcpy(co->GalleryDir, "YAM:Gallery");
  660.       strcpy(co->NewAddrGroup, "NEW");
  661.       co->AddMyInfo = FALSE;
  662.       co->AddToAddrbook = 0;
  663.       co->AddrbookCols = 1+2+4;
  664.    }
  665.    if (page == 13 || page < 0)
  666.    {
  667.       for (i = 0; i < MAXRX; i++)
  668.       {
  669.          *co->RX[i].Name = *co->RX[i].Script = 0;
  670.          co->RX[i].IsAmigaDOS = co->RX[i].UseConsole = FALSE;
  671.          co->RX[i].WaitTerm = TRUE;
  672.       }
  673.    }
  674.    if (page == 14 || page < 0)
  675.    {
  676.       strcpy(co->TempDir, "T:");
  677.       strcpy(co->PackerCommand,"LhA -a -m -i%l a \"%a\"");
  678.       co->IconPositionX = co->IconPositionY = 0;
  679.       co->IconifyOnQuit = co->RemoveAtOnce = FALSE;
  680.       co->Confirm = co->SaveSent = co->SendMDNAtOnce = TRUE;
  681.       co->ConfirmDelete = 2;
  682.       co->MDN_Display = co->MDN_Process = co->MDN_Delete = 2;
  683.       co->MDN_Filter = 3;
  684.       strcpy(co->XPKPack, "HUFF");
  685.       strcpy(co->XPKPackEncrypt, "HUFF");
  686.       co->XPKPackEff = 50;
  687.       co->XPKPackEncryptEff = 50;
  688.    }
  689.    if (page < 0)
  690.    {
  691.       co->LetterPart = 1;
  692.       co->WriteIndexes = 120;
  693.       co->AutoSave = 600;
  694.       strcpy(co->SupportSite, "http://www.yam.ch/");
  695.       co->JumpToNewMsg = co->PrinterCheck = co->IsOnlineCheck = TRUE;
  696.       co->ConfirmOnQuit = FALSE;
  697.       co->HideGUIElements = 0;
  698.       strcpy(co->LocalCharset, "iso-8859-1");
  699.       co->StackSize = 40000;
  700.    }
  701. }
  702. ///
  703. /// CO_CopyConfig
  704. //  Copies a configuration structure
  705. void CO_CopyConfig(struct Config *dco, struct Config *sco)
  706. {
  707.    int i;
  708.    memcpy(dco, sco, sizeof(struct Config));
  709.    for (i = 0; i < MAXP3; i++) dco->P3[i] = sco->P3[i] ? (struct POP3     *)AllocCopy(sco->P3[i], sizeof(struct POP3)) : NULL;
  710.    for (i = 0; i < MAXRU; i++) dco->RU[i] = sco->RU[i] ? (struct Rule     *)AllocCopy(sco->RU[i], sizeof(struct Rule)) : NULL;
  711.    for (i = 0; i < MAXMV; i++) dco->MV[i] = sco->MV[i] ? (struct MimeView *)AllocCopy(sco->MV[i], sizeof(struct MimeView)) : NULL;
  712. }
  713. ///
  714. /// CO_Validate
  715. //  Validates a configuration, update GUI etc.
  716. void CO_Validate(struct Config *co, BOOL update)
  717. {
  718.    char *p, buffer[SIZE_USERID];
  719.    int i;
  720.    if (!*co->SMTP_Server) strcpy(co->SMTP_Server, co->P3[0]->Server);
  721.    if (!*co->SMTP_Domain) { p = strchr(co->EmailAddress, '@'); strcpy(co->SMTP_Domain, p ? p+1 : ""); }
  722.    for (i = 0; i < MAXP3; i++) if (co->P3[i])
  723.    {
  724.       if (!*co->P3[i]->Server) strcpy(co->P3[i]->Server, co->SMTP_Server);
  725.       if (!*co->P3[i]->User)
  726.       {
  727.          stccpy(buffer, co->EmailAddress, SIZE_USERID);
  728.          if (p = strchr(buffer, '@')) *p = 0;
  729.          strcpy(co->P3[i]->User, buffer);
  730.       }
  731.       sprintf(co->P3[i]->Account, "%s@%s", co->P3[i]->User, co->P3[i]->Server);
  732.    }
  733.    if (G->CO_DST) co->DaylightSaving = G->CO_DST==2;
  734.    G->PGPVersion = CO_DetectPGP(co);
  735.    CreateDirectory(co->TempDir);
  736.    strmfp(G->WR_Filename[0], co->TempDir, "NewLetter.yam");
  737.    strmfp(G->WR_Filename[1], co->TempDir, "NewLetter.1.yam");
  738.    strmfp(G->WR_Filename[2], co->TempDir, "NewLetter.2.yam");
  739.    LoadTranslationTable(&(G->TTin), co->TranslationIn);
  740.    LoadTranslationTable(&(G->TTout), co->TranslationOut);
  741.    G->CO_Valid = (*co->SMTP_Server && *co->EmailAddress && *co->RealName);
  742.    if (update && G->CO)
  743.    {
  744.       switch (G->CO->VisiblePage)
  745.       {
  746.          case 0:
  747.             setstring(G->CO->GUI.ST_POPHOST0, co->P3[0]->Server);
  748.             break;
  749.          case 1:
  750.             setstring(G->CO->GUI.ST_SMTPHOST, co->SMTP_Server);
  751.             setstring(G->CO->GUI.ST_DOMAIN, co->SMTP_Domain);
  752.             DoMethod(G->CO->GUI.LV_POP3, MUIM_List_Redraw, MUIV_List_Redraw_All);
  753.             break;
  754.       }
  755.       if (G->CO->Visited[1] || G->CO->Visited[13] || G->CO->UpdateAll) MA_SetupDynamicMenus();
  756.       if (G->CO->Visited[8] || G->CO->UpdateAll)
  757.       {
  758.          SaveLayout(FALSE);
  759.          MA_MakeFOFormat(G->MA->GUI.NL_FOLDERS);
  760.          MA_MakeMAFormat(G->MA->GUI.NL_MAILS);
  761.          LoadLayout();
  762.       }
  763.       if (G->CO->Visited[12] || G->CO->UpdateAll) AB_MakeABFormat(G->AB->GUI.LV_ADRESSES);
  764.       if (G->CO->Visited[14] || G->CO->UpdateAll) { SetupAppIcons(); G->TotMsgs = -1; DisplayStatistics(FO_GetFolderByType(FT_INCOMING, NULL)); }
  765.    }
  766. }
  767. ///
  768. /// CO_ImportCTypes
  769. //  Imports MIME viewers from a MIME.prefs file
  770. SAVEDS void CO_ImportCTypesFunc(void)
  771. {
  772.    int mode;
  773.  
  774.    if (mode = MUI_Request(G->App, G->CO->GUI.WI, 0, GetStr(MSG_CO_ImportMIME), GetStr(MSG_CO_ImportMIMEGads), GetStr(MSG_CO_ImportMIMEReq)))
  775.       if (ReqFile(ASL_CONFIG,G->CO->GUI.WI, "Import MIME viewers & types", 0, (mode == 1 ? "ENV:" : G->MA_MailDir), (mode == 1 ? "MIME.prefs" : (mode == 2 ? "mailcap" : "mime.types"))))
  776.       {
  777.          char buffer[SIZE_LARGE], fname[SIZE_PATHFILE], *p, *p2;
  778.          struct MimeView *mv;
  779.          APTR lv = G->CO->GUI.LV_MIME;
  780.          int i;
  781.          FILE *fh;
  782.          strmfp(fname, G->ASLReq[ASL_CONFIG]->fr_Drawer, G->ASLReq[ASL_CONFIG]->fr_File);
  783.          if (fh = fopen(fname, "r"))
  784.          {
  785.             set(lv, MUIA_List_Quiet, TRUE);
  786.             while (fgets(buffer, SIZE_LARGE, fh))
  787.             {
  788.                char *ctype = buffer, *ext = "", *command = "";
  789.                if (p = strpbrk(ctype, "\r\n")) *p = 0;
  790.                if (!*ctype || ISpace(*ctype)) continue;
  791.                if (mode == 1)
  792.                {
  793.                   if (*ctype == ';') continue;
  794.                   for (p = ctype; *p && *p != ','; ++p);
  795.                   if (*p)
  796.                   {
  797.                      for (*p = 0, ext = ++p; *p && *p != ','; ++p);
  798.                      if (*p)
  799.                      {
  800.                         for (*p++ = 0; *p && *p != ','; ++p);
  801.                         if (*p)
  802.                         {
  803.                            for (command = ++p; *p && *p != ','; ++p);
  804.                            *p = 0;
  805.                         }
  806.                      }
  807.                   }
  808.                }
  809.                else if (mode == 2)
  810.                {
  811.                   if (*ctype == '#') continue;
  812.                   for (p2 = p = ctype; !ISpace(*p) && *p && *p != ';'; p2 = ++p);
  813.                   if (p = strpbrk(p,";")) ++p;
  814.                   if (p) command = stpblk(p);
  815.                   *p2 = 0;
  816.                }
  817.                else
  818.                {
  819.                   if (*ctype == '#') continue;
  820.                   for (p2 = p = ctype; !ISpace(*p) && *p; p2 = ++p);
  821.                   if (*p) ext = stpblk(p);
  822.                   *p2 = 0;
  823.                }
  824.                for (mv = NULL, i = 0; i < MAXMV; i++) if (CE->MV[i]) if (!stricmp(CE->MV[i]->ContentType, ctype)) { mv = CE->MV[i]; break; }
  825.                if (!mv) for (i = 0; i < MAXMV; i++) if (!CE->MV[i])
  826.                {
  827.                   mv = CE->MV[i] = CO_NewMimeView();
  828.                   DoMethod(lv, MUIM_List_InsertSingle, mv, MUIV_List_Insert_Bottom);
  829.                   break;
  830.                }
  831.                if (mv)
  832.                {
  833.                   for (p = mv->ContentType; *ctype && strlen(mv->ContentType) < SIZE_CTYPE; ctype++)
  834.                      if (*ctype == '*') { *p++ = '#'; *p++ = '?'; } else *p++ = *ctype;
  835.                   *p = 0;
  836.                   if (*command)
  837.                   {
  838.                      for (p = mv->Command; *command && strlen(mv->Command) < SIZE_COMMAND; command++)
  839.                         if (*command == '%' && command[1] == 'f') { *p++ = *command++; *p++ = 's'; } else *p++ = *command;
  840.                      *p = 0;
  841.                   }
  842.                   if (*ext) stccpy(mv->Extension, ext, SIZE_NAME);
  843.                }
  844.             }
  845.             fclose(fh);
  846.             set(lv, MUIA_List_Quiet, FALSE);
  847.             DoMethod(lv, MUIM_List_Redraw, MUIV_List_Redraw_All);
  848.          }
  849.          else ER_NewError(GetStr(MSG_ER_CantOpenFile), fname, NULL);
  850.       }
  851. }
  852. MakeHook(CO_ImportCTypesHook, CO_ImportCTypesFunc);
  853. ///
  854. /// CO_EditSignatFunc
  855. //  Edits the signature file
  856. SAVEDS ASM void CO_EditSignatFunc(REG(a1) int *arg)
  857. {
  858.    int sig = GetMUICycle(G->CO->GUI.CY_SIGNAT), modified;
  859.    char buffer[SIZE_COMMAND+SIZE_PATHFILE];
  860.    APTR ed = G->CO->GUI.TE_SIGEDIT;
  861.  
  862.    get(ed, MUIA_TextEditor_HasChanged, &modified);
  863.    if (modified) EditorToFile(ed, CreateFilename(SigNames[G->CO->LastSig]), NULL);
  864.    if (*arg) if (*(CE->Editor))
  865.    {
  866.       sprintf(buffer,"%s \"%s\"", CE->Editor, CreateFilename(SigNames[sig]));
  867.       ExecuteCommand(buffer, FALSE, OUT_NIL);
  868.    } else return;
  869.    if (!FileToEditor(CreateFilename(SigNames[sig]), ed)) DoMethod(ed, MUIM_TextEditor_ClearText);
  870.    set(ed, MUIA_TextEditor_HasChanged, FALSE);
  871.    G->CO->LastSig = sig;
  872. }
  873. MakeHook(CO_EditSignatHook,CO_EditSignatFunc);
  874. ///
  875. /// CO_OpenConfig
  876. //  Opens a different configuration file
  877. SAVEDS void CO_OpenConfig(void)
  878. {
  879.    if (ReqFile(ASL_CONFIG,G->CO->GUI.WI, GetStr(MSG_CO_Open), 0, G->MA_MailDir, ""))
  880.    {
  881.       char cname[SIZE_PATHFILE];
  882.       strmfp(cname, G->ASLReq[ASL_CONFIG]->fr_Drawer, G->ASLReq[ASL_CONFIG]->fr_File);
  883.       if (CO_LoadConfig(CE, cname, NULL)) CO_NewPrefsFile(cname);
  884.       CO_SetConfig();
  885.       G->CO->UpdateAll = TRUE;
  886.    }
  887. }
  888. MakeHook(CO_OpenConfigHook, CO_OpenConfig);
  889. ///
  890. /// CO_SaveConfigAs
  891. //  Saves configuration to a file using an alternative name
  892. SAVEDS void CO_SaveConfigAs(void)
  893. {
  894.    if (ReqFile(ASL_CONFIG,G->CO->GUI.WI, GetStr(MSG_CO_SaveAs), 1, G->MA_MailDir, ""))
  895.    {
  896.       char cname[SIZE_PATHFILE];
  897.       strmfp(cname, G->ASLReq[ASL_CONFIG]->fr_Drawer, G->ASLReq[ASL_CONFIG]->fr_File);
  898.       CO_GetConfig();
  899.       CO_Validate(CE, TRUE);
  900.       CO_NewPrefsFile(cname);
  901.       CO_SaveConfig(CE, cname);
  902.    }
  903. }
  904. MakeHook(CO_SaveConfigAsHook, CO_SaveConfigAs);
  905. ///
  906. /// CO_Restore
  907. //  Makes all changes undone
  908. SAVEDS void CO_Restore(void)
  909. {                    
  910.    CO_FreeConfig(CE);
  911.    CO_CopyConfig(CE, C);
  912.    CO_SetConfig();
  913. }
  914. MakeHook(CO_RestoreHook,CO_Restore);
  915. ///
  916. /// CO_LastSaved
  917. //  Reloads configuration from file
  918. SAVEDS void CO_LastSaved(void)
  919. {
  920.    CO_LoadConfig(CE, G->CO_PrefsFile, NULL);
  921.    CO_SetConfig();
  922.    G->CO->UpdateAll = TRUE;
  923. }
  924. MakeHook(CO_LastSavedHook,CO_LastSaved);
  925. ///
  926. /// CO_ResetToDefaultFunc
  927. //  Resets configuration (or a part of it)
  928. SAVEDS ASM void CO_ResetToDefaultFunc(REG(a1) int *arg)
  929. {
  930.    if (*arg) { CO_SetDefaults(CE, -1); G->CO->UpdateAll = TRUE; }
  931.    else CO_SetDefaults(CE, G->CO->VisiblePage);
  932.    CO_SetConfig();
  933. }
  934. MakeHook(CO_ResetToDefaultHook,CO_ResetToDefaultFunc);
  935. ///
  936. /// CO_BuildPage
  937. //  Creates a GUI section of the configuration
  938. APTR CO_BuildPage(struct CO_ClassData *data, int page)
  939. {
  940.    switch (page)
  941.    {
  942.       case  0: return CO_Page0(data);
  943.       case  1: return CO_Page1(data);
  944.       case  2: return CO_Page2(data);
  945.       case  3: return CO_Page3(data);
  946.       case  4: return CO_Page4(data);
  947.       case  5: return CO_Page5(data);
  948.       case  6: return CO_Page6(data);
  949.       case  7: return CO_Page7(data);
  950.       case  8: return CO_Page8(data);
  951.       case  9: return CO_Page9(data);
  952.       case 10: return CO_Page10(data);
  953.       case 11: return CO_Page11(data);
  954.       case 12: return CO_Page12(data);
  955.       case 13: return CO_Page13(data);
  956.       case 14: return CO_Page14(data);
  957.    }
  958. }
  959. ///
  960. /// CO_ChangePageFunc
  961. //  Selects a different section of the configuration
  962. SAVEDS ASM void CO_ChangePageFunc(REG(a1) int *arg)
  963. {
  964.    struct CO_GUIData *gui = &G->CO->GUI;
  965.    if (*arg < 0 || *arg >= MAXCPAGES) return;
  966.    set(gui->WI, MUIA_Window_Sleep, TRUE);
  967.    CO_GetConfig();
  968.    if (DoMethod(gui->GR_PAGE, MUIM_Group_InitChange))
  969.    {
  970.       DoMethod(gui->GR_PAGE, OM_REMMEMBER, gui->GR_SUBPAGE);
  971.       MUI_DisposeObject(gui->GR_SUBPAGE);
  972.       if (gui->GR_SUBPAGE = CO_BuildPage(G->CO, *arg))
  973.       {
  974.          DoMethod(gui->GR_PAGE, OM_ADDMEMBER, gui->GR_SUBPAGE);
  975.          G->CO->VisiblePage = *arg;
  976.          G->CO->Visited[*arg] = TRUE;
  977.       }
  978.       DoMethod(gui->GR_PAGE, MUIM_Group_ExitChange);
  979.       set(gui->MI_IMPMIME, MUIA_Menuitem_Enabled, *arg == 11);
  980.       CO_SetConfig();
  981.    }
  982.    set(gui->WI, MUIA_Window_Sleep, FALSE);
  983. }
  984. MakeHook(CO_ChangePageHook,CO_ChangePageFunc);
  985. ///
  986. /// CO_CloseFunc
  987. //  Closes configuration window
  988. SAVEDS ASM void CO_CloseFunc(REG(a1) int *arg)
  989. {
  990.    if (*arg >= 1)
  991.    {
  992.       CO_GetConfig();
  993.       CO_FreeConfig(C);
  994.       CO_CopyConfig(C, CE);
  995.       CO_Validate(C, TRUE);
  996.       if (*arg == 2) CO_SaveConfig(C, G->CO_PrefsFile);
  997.    }
  998.    CO_FreeConfig(CE); free(CE);
  999.    DisposeModulePush(&G->CO);
  1000. }
  1001. MakeHook(CO_CloseHook,CO_CloseFunc);
  1002. ///
  1003. /// CO_OpenFunc
  1004. //  Opens configuration window
  1005. SAVEDS void CO_OpenFunc(void)
  1006. {
  1007.    if (!G->CO)
  1008.    {
  1009.       if (!(G->CO = CO_New())) return;
  1010.       CE = malloc(sizeof(struct Config));
  1011.       CO_CopyConfig(CE, C);
  1012.       CO_SetConfig();
  1013.       CO_NewPrefsFile(G->CO_PrefsFile);
  1014.    }
  1015.    if (!SafeOpenWindow(G->CO->GUI.WI)) CO_CloseFunc(0);
  1016. }
  1017. MakeHook(CO_OpenHook,CO_OpenFunc);
  1018. ///
  1019.  
  1020. /*** GUI ***/
  1021.  
  1022. /// CO_PL_DspFunc
  1023. //  Section listview displayhook
  1024. SAVEDS ASM long CO_PL_DspFunc(REG(a0) struct Hook *hook, REG(a2) char **array, REG(a1) struct PageList *entry)
  1025. {
  1026.    static char page[SIZE_DEFAULT];
  1027.    struct PL_Data *data = (APTR)hook->h_Data;
  1028.    sprintf(array[0] = page, "\033O[%08lx] %s", data->Image[entry->Offset], GetStr(entry->Label));
  1029.    return 0;
  1030. }
  1031. ///
  1032. /// Images
  1033. //  Images for section listview in ILBM/BODY format
  1034. UBYTE PL_IconBody[MAXCPAGES][240] = {
  1035. { /* 0 */
  1036. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0xff,0x00,0x01,0x10,0x00,0xff,0x00,0x01,0xf0,
  1037. 0x00,0xff,0x00,0x01,0x18,0x00,0xff,0x00,0x01,0xf8,0x00,0x03,0x00,0x01,0x88,
  1038. 0x00,0xfd,0x00,0x03,0x00,0x01,0xf0,0x00,0x03,0x00,0x03,0xc0,0x00,0xff,0x00,
  1039. 0x01,0x0c,0x00,0x03,0x00,0x02,0xe0,0x00,0x03,0x00,0x06,0x80,0x00,0x03,0x00,
  1040. 0x01,0x18,0x00,0x03,0x00,0x04,0xc0,0x00,0x03,0x00,0x0c,0x00,0x00,0x03,0x00,
  1041. 0x03,0x30,0x00,0x03,0x11,0x09,0x80,0x00,0x03,0x1f,0x1c,0x00,0x00,0x03,0x11,
  1042. 0x06,0x60,0x00,0x03,0x0f,0x93,0x00,0x00,0x03,0x00,0x3c,0x00,0x00,0x03,0x00,
  1043. 0x8c,0xc0,0x00,0x03,0x05,0xf6,0x00,0x00,0x03,0x03,0x38,0x00,0x00,0x03,0x01,
  1044. 0x59,0x80,0x00,0x03,0x03,0xfc,0x00,0x00,0x03,0x01,0xf0,0x00,0x00,0x03,0x01,
  1045. 0xb3,0x00,0x00,0x03,0x01,0xb8,0x00,0x00,0x03,0x00,0xe0,0x00,0x00,0x03,0x00,
  1046. 0xa6,0x00,0x00,0x03,0x00,0xb0,0x00,0x00,0x03,0x00,0x40,0x00,0x00,0x03,0x00,
  1047. 0x0c,0x00,0x00,0x03,0x00,0x60,0x00,0x00,0xfd,0x00,0x03,0x00,0x18,0x00,0x00,
  1048. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00, },
  1049. { /* 1 */
  1050. 0x03,0x1c,0x00,0x70,0x00,0xfd,0x00,0x03,0x1c,0x00,0x70,0x00,0x03,0x22,0x00,
  1051. 0x88,0x00,0xfd,0x00,0x03,0x3e,0x00,0xf8,0x00,0x03,0x57,0xff,0x5c,0x00,0x03,
  1052. 0x1e,0x00,0x78,0x00,0x03,0x75,0xff,0xd4,0x00,0x03,0x4f,0xff,0x3c,0x00,0x03,
  1053. 0x1d,0xff,0x70,0x00,0x03,0x6c,0x00,0xb4,0x00,0x03,0x5a,0xfe,0xec,0x00,0x03,
  1054. 0x18,0x00,0xe0,0x00,0x03,0x7c,0xfe,0x74,0x00,0x03,0x3f,0x7d,0x78,0x00,0x03,
  1055. 0x13,0x01,0x48,0x00,0x03,0x20,0xfe,0x00,0x00,0x03,0x3f,0x45,0xf0,0x00,0x03,
  1056. 0x08,0x44,0x20,0x00,0x03,0x37,0x29,0xd0,0x00,0x03,0x3f,0xd7,0xf0,0x00,0x03,
  1057. 0x08,0x10,0x20,0x00,0x03,0x37,0xef,0xd0,0x00,0x03,0x23,0x45,0x88,0x00,0x03,
  1058. 0x00,0x44,0x00,0x00,0x03,0x3f,0x29,0xf8,0x00,0x03,0x57,0x7d,0xdc,0x00,0x03,
  1059. 0x1f,0x01,0xf8,0x00,0x03,0x74,0xfe,0x54,0x00,0x03,0x4f,0x7f,0x3c,0x00,0x03,
  1060. 0x1d,0x7f,0x70,0x00,0x03,0x6c,0x80,0xb4,0x00,0x03,0x5b,0xff,0x6c,0x00,0x03,
  1061. 0x18,0x00,0x60,0x00,0x03,0x7d,0xff,0xf4,0x00,0x03,0x3f,0x00,0xf8,0x00,0x03,
  1062. 0x12,0x00,0x48,0x00,0x03,0x21,0x00,0x80,0x00,0x03,0x1e,0x00,0x70,0x00,0xfd,
  1063. 0x00,0x03,0x1e,0x00,0x70,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00, },
  1064. { /* 2 */
  1065. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00,0x03,0x3f,0xff,
  1066. 0xf8,0x00,0x03,0x3f,0xff,0xf8,0x00,0xfd,0x00,0x03,0x20,0x00,0x18,0x00,0x03,
  1067. 0x3f,0xff,0xe0,0x00,0xff,0x00,0x01,0x14,0x00,0x03,0x2e,0x01,0x58,0x00,0x03,
  1068. 0x31,0xff,0xe0,0x00,0x03,0x0e,0x01,0xd4,0x00,0x03,0x24,0x01,0x98,0x00,0x03,
  1069. 0x3b,0xff,0xe0,0x00,0x03,0x04,0x01,0xd4,0x00,0x03,0x20,0x01,0x18,0x00,0x03,
  1070. 0x3f,0xff,0xe0,0x00,0x03,0x00,0x01,0xd4,0x00,0x03,0x20,0x6c,0x18,0x00,0x03,
  1071. 0x3f,0x93,0xe0,0x00,0x03,0x00,0x6c,0x14,0x00,0x03,0x20,0x55,0x18,0x00,0x03,
  1072. 0x3f,0xaa,0xe0,0x00,0x03,0x00,0x55,0x14,0x00,0x03,0x20,0x6b,0x18,0x00,0x03,
  1073. 0x3f,0x94,0xe0,0x00,0x03,0x00,0x6b,0x14,0x00,0x03,0x20,0x00,0x18,0x00,0x03,
  1074. 0x3f,0xff,0xe0,0x00,0xff,0x00,0x01,0x14,0x00,0x03,0x3f,0xff,0xf8,0x00,0x00,
  1075. 0x20,0xfe,0x00,0x03,0x1f,0xff,0xf4,0x00,0x03,0x3f,0xff,0xf8,0x00,0xfd,0x00,
  1076. 0xff,0x00,0x01,0x04,0x00,0xfd,0x00,0xfd,0x00,0x03,0x1f,0xff,0xfc,0x00,0xfd,
  1077. 0x00,0xfd,0x00,0xfd,0x00, },
  1078. { /* Folders
  1079. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x03,0x03,0xce,0x70,0x00,0x03,0x03,0xce,0x70,
  1080. 0x00,0x03,0x00,0x21,0x08,0x00,0x03,0xfa,0x21,0x00,0x00,0x03,0xfb,0xef,0x70,
  1081. 0x00,0x03,0x00,0x10,0x8c,0x00,0x03,0x86,0xd6,0xb4,0x00,0x03,0xff,0x7b,0xdc,
  1082. 0x00,0x03,0x00,0xc6,0x30,0x00,0x03,0xbb,0xff,0x1c,0x00,0x03,0xcf,0xff,0x34,
  1083. 0x00,0x03,0x38,0x00,0xda,0x00,0x03,0x80,0x00,0x7c,0x00,0xff,0xff,0x01,0x68,
  1084. 0x00,0xff,0x00,0x01,0xba,0x00,0x03,0x80,0x00,0xfc,0x00,0xff,0xff,0x01,0x10,
  1085. 0x00,0xff,0x00,0x01,0xba,0x00,0x03,0x9d,0x54,0xfc,0x00,0x03,0xea,0xab,0x28,
  1086. 0x00,0x03,0x1d,0x54,0xba,0x00,0x03,0x8b,0xac,0xfc,0x00,0x03,0xf5,0x57,0x10,
  1087. 0x00,0x03,0x0b,0xac,0xba,0x00,0x03,0x95,0x54,0xfc,0x00,0x03,0xfa,0xab,0x28,
  1088. 0x00,0x03,0x15,0x54,0xba,0x00,0x03,0x8a,0xac,0xfc,0x00,0x03,0xfd,0x57,0x10,
  1089. 0x00,0x03,0x0a,0xac,0xba,0x00,0x03,0x80,0x00,0xfc,0x00,0xff,0xff,0xff,0x00,
  1090. 0xff,0x00,0x01,0x82,0x00,0xff,0xff,0x01,0xc0,0x00,0x00,0x80,0xfe,0x00,0x03,
  1091. 0x7f,0xff,0xbe,0x00,0xff,0xff,0x01,0xc0,0x00,0xfd,0x00,0xff,0x00,0x01,0x20,
  1092. 0x00,0xfd,0x00,0xfd,0x00,0x03,0x7f,0xff,0xe0,0x00, },
  1093. {  3 */
  1094. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x03,0x01,0xff,0x00,0x00,0x03,0x01,0xff,0x00,
  1095. 0x00,0xfd,0x00,0x03,0x0e,0xa0,0xe0,0x00,0x03,0x0e,0x08,0xe0,0x00,0x03,0x01,
  1096. 0xfe,0x00,0x00,0x03,0x12,0x2a,0x18,0x00,0x03,0x10,0x00,0x98,0x00,0x03,0x0a,
  1097. 0x7f,0xe0,0x00,0x03,0x06,0x80,0x10,0x00,0x03,0x00,0x2a,0x00,0x00,0x03,0x1f,
  1098. 0xff,0xe8,0x00,0x03,0x0c,0x28,0x30,0x00,0x03,0x08,0x02,0xa0,0x00,0x03,0x04,
  1099. 0x7f,0xc8,0x00,0x03,0x02,0x80,0x30,0x00,0x03,0x00,0x2a,0x10,0x00,0x03,0x0f,
  1100. 0xff,0xc0,0x00,0x03,0x06,0x20,0x60,0x00,0x03,0x04,0x0a,0xc0,0x00,0x03,0x02,
  1101. 0x7f,0x90,0x00,0x03,0x00,0x80,0x60,0x00,0x03,0x00,0x2a,0x20,0x00,0x03,0x06,
  1102. 0xff,0x80,0x00,0x03,0x02,0x20,0xc0,0x00,0x03,0x02,0x08,0x80,0x00,0x03,0x00,
  1103. 0x7f,0x20,0x00,0xff,0x00,0x01,0xc0,0x00,0x03,0x00,0x2a,0x40,0x00,0x03,0x03,
  1104. 0x7f,0x00,0x00,0xff,0x01,0x01,0x80,0x00,0x03,0x01,0x09,0x00,0x00,0x03,0x00,
  1105. 0x5e,0x40,0x00,0x03,0x00,0xff,0x80,0x00,0x03,0x00,0x80,0x80,0x00,0x00,0x01,
  1106. 0xfe,0x00,0xfd,0x00,0xfd,0x00,0x03,0x00,0xff,0x80,0x00,0xfd,0x00,0xfd,0x00,
  1107. 0xfd,0x00, },
  1108. { /* 4 */
  1109. 0x03,0x00,0xfe,0x00,0x00,0x03,0x00,0x28,0x00,0x00,0xfd,0x00,0x03,0x01,0xff,
  1110. 0x00,0x00,0x03,0x00,0x82,0x00,0x00,0x03,0x02,0x00,0x80,0x00,0x03,0x01,0x93,
  1111. 0x00,0x00,0x03,0x00,0x7c,0x00,0x00,0x03,0x02,0x7c,0x80,0x00,0x03,0x01,0xbb,
  1112. 0x00,0x00,0x03,0x01,0x45,0x00,0x00,0x03,0x02,0xaa,0x80,0x00,0x03,0x19,0x55,
  1113. 0x30,0x00,0x03,0x09,0xab,0x20,0x00,0x03,0x02,0x00,0x88,0x00,0x03,0x1f,0xbb,
  1114. 0xf0,0x00,0x03,0x12,0x44,0x90,0x00,0x03,0x08,0xaa,0x28,0x00,0x03,0x12,0x38,
  1115. 0x90,0x00,0x03,0x0c,0x54,0x60,0x00,0x03,0x03,0xd7,0x88,0x00,0x03,0x38,0x10,
  1116. 0x38,0x00,0x03,0x17,0xef,0xd0,0x00,0x03,0x40,0x10,0x04,0x00,0x03,0x55,0xf7,
  1117. 0x54,0x00,0x03,0x3e,0x08,0xf8,0x00,0x03,0x39,0xf7,0x3a,0x00,0x03,0x55,0x11,
  1118. 0x54,0x00,0x03,0x3e,0xaa,0xf8,0x00,0x03,0x39,0x55,0x3a,0x00,0x03,0x39,0xbb,
  1119. 0x38,0x00,0x03,0x16,0x44,0xd0,0x00,0x03,0x41,0xbb,0x04,0x00,0xff,0x11,0x01,
  1120. 0x30,0x00,0x03,0x0f,0xab,0xc0,0x00,0x03,0x01,0x55,0x28,0x00,0x03,0x0c,0x00,
  1121. 0x60,0x00,0x03,0x03,0xff,0x80,0x00,0x03,0x14,0x00,0x50,0x00,0x03,0x07,0xff,
  1122. 0xc0,0x00,0x00,0x04,0xfe,0x00,0xff,0x00,0x01,0x20,0x00,0xfd,0x00,0xfd,0x00,
  1123. 0x03,0x03,0xff,0xc0,0x00, },
  1124. { /* 5 */
  1125. 0xff,0x00,0x01,0x1a,0x00,0xff,0x00,0x01,0x1e,0x00,0xff,0x00,0x01,0x0c,0x00,
  1126. 0x03,0x00,0x60,0x24,0x00,0x03,0x00,0x60,0x38,0x00,0xff,0x00,0x01,0x08,0x00,
  1127. 0x03,0x00,0x90,0x58,0x00,0x03,0x00,0xf0,0x70,0x00,0xff,0x00,0x01,0x10,0x00,
  1128. 0x03,0x01,0x28,0xb0,0x00,0x03,0x01,0xf8,0xe0,0x00,0x03,0x00,0x20,0x20,0x00,
  1129. 0x03,0x02,0x55,0x60,0x00,0x03,0x03,0xed,0xc0,0x00,0x03,0x00,0x50,0x40,0x00,
  1130. 0x03,0x04,0xaa,0xc0,0x00,0x03,0x07,0xd5,0x80,0x00,0x03,0x00,0xa8,0x80,0x00,
  1131. 0x03,0x09,0x55,0x84,0x00,0x03,0x0f,0xab,0x04,0x00,0x03,0x01,0x51,0x18,0x00,
  1132. 0x03,0x12,0xab,0xa8,0x00,0x03,0x1f,0x5e,0x28,0x00,0x03,0x02,0xa2,0x54,0x00,
  1133. 0x03,0x25,0x5e,0x40,0x00,0x03,0x3e,0xbc,0x00,0x00,0x03,0x05,0x4d,0xb0,0x00,
  1134. 0x03,0x4a,0xbd,0x60,0x00,0x03,0x7d,0x58,0x20,0x00,0x03,0x0a,0xb3,0xc0,0x00,
  1135. 0x03,0x15,0x7b,0x50,0x00,0x03,0x7a,0x88,0xb0,0x00,0x03,0x15,0x67,0x40,0x00,
  1136. 0x03,0x2a,0xaa,0xa8,0x00,0x03,0x75,0x55,0x58,0x00,0x03,0x2a,0xaa,0xa0,0x00,
  1137. 0xff,0x55,0x01,0x54,0x00,0x03,0x6a,0xaa,0xac,0x00,0xff,0x55,0x01,0x50,0x00,
  1138. 0xff,0x55,0x01,0x56,0x00,0xff,0x00,0x01,0x02,0x00,0x03,0x7f,0xff,0xfc,0x00,
  1139. 0xfd,0x00,0xfd,0x00,0xfd,0x00, },
  1140. { /* 6 */
  1141. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0xff,0x00,0x01,0x20,0x00,0xff,0x00,0x01,0x40,
  1142. 0x00,0xfd,0x00,0x03,0x00,0x80,0x10,0x00,0x03,0x00,0x7f,0xc0,0x00,0x03,0x00,
  1143. 0x80,0x20,0x00,0x03,0x01,0x00,0x08,0x00,0x03,0x00,0xf4,0x00,0x00,0x03,0x01,
  1144. 0x7f,0xf0,0x00,0x03,0x02,0x00,0x18,0x00,0x03,0x01,0xfa,0x10,0x00,0x03,0x02,
  1145. 0xff,0xe4,0x00,0x03,0x00,0x33,0xf0,0x00,0x03,0x03,0xdd,0x20,0x00,0x03,0x01,
  1146. 0xcc,0x4c,0x00,0x03,0x00,0x69,0x20,0x00,0x03,0x03,0xa6,0x40,0x00,0x03,0x01,
  1147. 0x9e,0x98,0x00,0x03,0x08,0x61,0x00,0x00,0x03,0x13,0xee,0x00,0x00,0x03,0x01,
  1148. 0x96,0xf0,0x00,0x03,0x18,0xa1,0x00,0x00,0x03,0x37,0x5c,0x00,0x00,0x03,0x10,
  1149. 0xee,0x80,0x00,0x03,0x3d,0x02,0x00,0x00,0x03,0x62,0xf8,0x00,0x00,0x03,0x3f,
  1150. 0xfd,0x80,0x00,0x03,0x7e,0xce,0x00,0x00,0x03,0x69,0x3a,0x00,0x00,0x03,0x3f,
  1151. 0xf1,0x00,0x00,0x03,0x3f,0xf8,0x00,0x00,0x03,0x30,0x08,0x00,0x00,0x03,0x10,
  1152. 0x06,0x00,0x00,0x00,0x18,0xfe,0x00,0x00,0x10,0xfe,0x00,0x03,0x27,0xf8,0x00,
  1153. 0x00,0xfd,0x00,0xfd,0x00,0x00,0x1c,0xfe,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00, },
  1154. { /* 7 */
  1155. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x03,0x01,0x20,0x24,0x00,0x03,0x00,0x20,0x24,
  1156. 0x00,0x03,0x00,0x10,0x00,0x00,0x03,0x01,0x20,0x24,0x00,0x00,0x01,0xfe,0x00,
  1157. 0x00,0x02,0xfe,0x00,0x03,0x02,0x60,0x4c,0x00,0x03,0x02,0x60,0x4c,0x00,0x03,
  1158. 0x01,0x00,0x20,0x00,0x03,0x02,0x40,0x48,0x00,0xfd,0x00,0xfd,0x00,0x03,0x04,
  1159. 0x80,0x98,0x00,0xff,0x00,0x01,0x90,0x00,0xff,0x00,0x01,0x40,0x00,0x03,0x15,
  1160. 0xa4,0x96,0x00,0x03,0x15,0x84,0x02,0x00,0x03,0x08,0x02,0x08,0x00,0x03,0x1d,
  1161. 0x64,0xa2,0x00,0x03,0x08,0x20,0xa2,0x00,0x03,0x00,0x01,0x10,0x00,0x03,0x1f,
  1162. 0xc9,0x24,0x00,0x03,0x1d,0x41,0x00,0x00,0xff,0x00,0x01,0x8a,0x00,0x03,0x3e,
  1163. 0x5d,0xc8,0x00,0x03,0x2a,0x08,0x80,0x00,0x03,0x00,0x22,0x14,0x00,0x03,0x6c,
  1164. 0x76,0x8e,0x00,0x03,0x44,0x54,0x0c,0x00,0x03,0x02,0x08,0x40,0x00,0x00,0x4c,
  1165. 0xfe,0x00,0x00,0x08,0xfe,0x00,0xfd,0x00,0x00,0xd8,0xfe,0x00,0x00,0xd0,0xfe,
  1166. 0x00,0x00,0x04,0xfe,0x00,0x00,0xa8,0xfe,0x00,0x00,0x88,0xfe,0x00,0x00,0x40,
  1167. 0xfe,0x00,0x00,0xc0,0xfe,0x00,0x00,0x40,0xfe,0x00,0xfd,0x00, },
  1168. { /* 8 */
  1169. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x00,0x78,0xfe,0x00,0x00,0x48,0xfe,0x00,0x00,
  1170. 0x04,0xfe,0x00,0x00,0x8e,0xfe,0x00,0x00,0xb0,0xfe,0x00,0x00,0x49,0xfe,0x00,
  1171. 0x03,0x83,0xe0,0x00,0x00,0x03,0x7d,0x60,0x00,0x00,0x03,0x02,0x10,0x00,0x00,
  1172. 0x03,0xbb,0xfc,0x00,0x00,0x03,0x7e,0xec,0x00,0x00,0x03,0x3f,0x62,0x00,0x00,
  1173. 0x03,0xc1,0xfb,0x78,0x00,0x03,0x3f,0xc2,0x48,0x00,0x03,0x40,0xdc,0x80,0x00,
  1174. 0x03,0xff,0xf0,0x4c,0x00,0x03,0x81,0xdf,0x0c,0x00,0x03,0x00,0xb0,0xb0,0x00,
  1175. 0x03,0x03,0xd9,0xbc,0x00,0x03,0x02,0xbe,0x10,0x00,0x03,0x7c,0x19,0x78,0x00,
  1176. 0x03,0x03,0xe5,0xa4,0x00,0x03,0x02,0x5e,0x08,0x00,0x03,0x01,0x06,0xd0,0x00,
  1177. 0x03,0x07,0x9b,0xd4,0x00,0x03,0x07,0x06,0x28,0x00,0x03,0x03,0x6a,0x82,0x00,
  1178. 0x03,0x3e,0x8d,0xec,0x00,0x03,0x26,0x02,0x90,0x00,0x03,0x07,0x74,0x4a,0x00,
  1179. 0x03,0x05,0x04,0xfc,0x00,0x03,0x04,0x02,0x04,0x00,0x03,0x0a,0xe9,0x72,0x00,
  1180. 0x03,0x0e,0x03,0xf8,0x00,0x03,0x08,0x03,0x48,0x00,0x03,0x01,0x85,0x06,0x00,
  1181. 0xfd,0x00,0xfd,0x00,0x03,0x00,0x03,0xfc,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00, },
  1182. { /* 9 */
  1183. 0x03,0x00,0x7c,0x00,0x00,0x03,0x00,0x7c,0x00,0x00,0x03,0x00,0x82,0x00,0x00,
  1184. 0xff,0x01,0xff,0x00,0x03,0x01,0xf9,0x00,0x00,0xfd,0x00,0x03,0x00,0x79,0x00,
  1185. 0x00,0x03,0x01,0xbc,0x00,0x00,0x00,0x02,0xfe,0x00,0x03,0x02,0x85,0x00,0x00,
  1186. 0x03,0x03,0x06,0x00,0x00,0x03,0x00,0x40,0x80,0x00,0x03,0x02,0x85,0x00,0x00,
  1187. 0x03,0x03,0x06,0x00,0x00,0xff,0x00,0x01,0x80,0x00,0x03,0x00,0x85,0x00,0x00,
  1188. 0x03,0x01,0x06,0x00,0x00,0x03,0x02,0x00,0x80,0x00,0x03,0x05,0xbb,0x80,0x00,
  1189. 0x03,0x07,0x2a,0x00,0x00,0x03,0x05,0xbb,0xc0,0x00,0x03,0x03,0x00,0x40,0x00,
  1190. 0x03,0x06,0x7e,0x00,0x00,0x03,0x0b,0x7e,0xa0,0x00,0x03,0x02,0x10,0x40,0x00,
  1191. 0x03,0x04,0xd6,0x00,0x00,0x03,0x0a,0xef,0xa0,0x00,0x03,0x07,0x38,0x40,0x00,
  1192. 0x03,0x04,0x6e,0x00,0x00,0x03,0x0f,0x46,0xa0,0x00,0x03,0x06,0x10,0x40,0x00,
  1193. 0x03,0x04,0xc6,0x00,0x00,0x03,0x0e,0xef,0xa0,0x00,0x03,0x07,0x38,0x40,0x00,
  1194. 0x03,0x04,0x6e,0x00,0x00,0x03,0x0f,0x46,0xa0,0x00,0x03,0x06,0x00,0x40,0x00,
  1195. 0x03,0x04,0xfe,0x00,0x00,0x03,0x0e,0xff,0xa0,0x00,0x03,0x03,0xff,0xc0,0x00,
  1196. 0xff,0x00,0x01,0x40,0x00,0x03,0x04,0x00,0x20,0x00,0xfd,0x00,0xfd,0x00,0x03,
  1197. 0x03,0xff,0xc0,0x00, },
  1198. { /* 10 */
  1199. 0x03,0x00,0x04,0x00,0x00,0x03,0x00,0x04,0x00,0x00,0x03,0x00,0xfb,0x00,0x00,
  1200. 0x03,0x00,0xf9,0x00,0x00,0x03,0x00,0x01,0x00,0x00,0x03,0x03,0xfa,0x80,0x00,
  1201. 0x03,0x01,0x1c,0x80,0x00,0x03,0x00,0xf8,0x80,0x00,0x03,0x03,0x1d,0x40,0x00,
  1202. 0x03,0x02,0x7e,0xc0,0x00,0x03,0x01,0xc0,0xc0,0x00,0x03,0x06,0x7e,0x20,0x00,
  1203. 0x03,0x02,0xfe,0x40,0x00,0x03,0x01,0x80,0x00,0x00,0x03,0x06,0xfe,0xa0,0x00,
  1204. 0x03,0x02,0xc2,0x40,0x00,0x00,0x01,0xfe,0x00,0x03,0x06,0xe6,0xa0,0x00,0x03,
  1205. 0x03,0xe6,0x40,0x00,0x03,0x01,0x24,0x00,0x00,0x03,0x07,0xf7,0xa0,0x00,0x03,
  1206. 0x03,0xf5,0xc0,0x00,0x03,0x02,0x91,0x40,0x00,0x03,0x01,0xe4,0x20,0x00,0x03,
  1207. 0x01,0x61,0x80,0x00,0x03,0x01,0x00,0x80,0x00,0x03,0x00,0x6e,0x40,0x00,0x03,
  1208. 0x00,0xdf,0x00,0x00,0x03,0x00,0xe5,0x00,0x00,0x03,0x00,0x50,0x80,0x00,0x03,
  1209. 0x00,0xf7,0x00,0x00,0x03,0x00,0xcd,0x00,0x00,0x03,0x00,0x14,0x80,0x00,0x03,
  1210. 0x00,0xdf,0x00,0x00,0x03,0x00,0xe5,0x00,0x00,0x03,0x00,0x50,0x80,0x00,0x03,
  1211. 0x00,0x5b,0x00,0x00,0x03,0x00,0x49,0x00,0x00,0x03,0x00,0xbc,0x80,0x00,0x03,
  1212. 0x00,0x7e,0x00,0x00,0x03,0x00,0x62,0x00,0x00,0x03,0x00,0x01,0x00,0x00,0xfd,
  1213. 0x00,0xfd,0x00,0xfd,0x00, },
  1214. { /* 11 */
  1215. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x03,0x00,0xfe,0x00,0x00,0x03,0x00,0xfe,0x00,
  1216. 0x00,0x03,0x00,0xfe,0x00,0x00,0x03,0x03,0xeb,0x80,0x00,0x03,0x03,0xeb,0x80,
  1217. 0x00,0x03,0x03,0xeb,0x80,0x00,0x03,0x04,0xfe,0x40,0x00,0x03,0x04,0x82,0x40,
  1218. 0x00,0x03,0x05,0x00,0x40,0x00,0x03,0x0b,0x9f,0xe0,0x00,0x03,0x0a,0xb3,0x60,
  1219. 0x00,0x03,0x0c,0x00,0x20,0x00,0x03,0x1a,0xdc,0xe0,0x00,0x03,0x18,0x78,0xd0,
  1220. 0x00,0x03,0x15,0x01,0x18,0x00,0x03,0x32,0xf4,0xd8,0x00,0x03,0x32,0x10,0xd8,
  1221. 0x00,0x03,0x21,0x0b,0x44,0x00,0x03,0x62,0xf8,0x08,0x00,0x03,0x6e,0x80,0x64,
  1222. 0x00,0x03,0x41,0x05,0x04,0x00,0x03,0xc1,0x00,0x30,0x00,0x03,0xdd,0x22,0xe0,
  1223. 0x00,0x03,0xa0,0xf7,0x28,0x00,0x03,0x90,0x80,0x60,0x00,0x03,0x9e,0x85,0xc0,
  1224. 0x00,0x03,0x90,0x56,0x50,0x00,0x03,0x3c,0x61,0x40,0x00,0x03,0xbf,0x63,0x00,
  1225. 0x00,0x03,0xc4,0x19,0xa0,0x00,0x03,0x0f,0xa9,0x80,0x00,0x03,0x0b,0xfd,0x00,
  1226. 0x00,0x03,0x31,0xa8,0x40,0x00,0x03,0x03,0xff,0x00,0x00,0x03,0x02,0x01,0x00,
  1227. 0x00,0x03,0x0c,0x00,0x80,0x00,0x03,0x00,0x7c,0x00,0x00,0x03,0x00,0x7c,0x00,
  1228. 0x00,0x03,0x03,0x82,0x00,0x00,0xfd,0x00,0xfd,0x00,0xfd,0x00, },
  1229. { /* 12 */
  1230. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x03,0x07,0xff,0xc0,0x00,0x03,0x07,0xff,0xc0,
  1231. 0x00,0x03,0x08,0x00,0x20,0x00,0x03,0x0a,0x00,0x20,0x00,0x03,0x0d,0xff,0x80,
  1232. 0x00,0x00,0x02,0xfe,0x00,0x03,0x0e,0x00,0x20,0x00,0x03,0x0a,0x00,0x40,0x00,
  1233. 0x03,0x05,0xff,0x80,0x00,0x03,0x0b,0xff,0x20,0x00,0x03,0x0b,0xff,0x40,0x00,
  1234. 0xff,0x00,0x01,0x80,0x00,0x03,0x0b,0xff,0x20,0x00,0x03,0x0b,0xff,0x40,0x00,
  1235. 0xff,0x00,0x01,0x80,0x00,0x03,0x0b,0xff,0xa0,0x00,0x03,0x0b,0x03,0xc0,0x00,
  1236. 0xfd,0x00,0x03,0x0b,0xff,0x20,0x00,0x03,0x0a,0x79,0x40,0x00,0x03,0x04,0x00,
  1237. 0x80,0x00,0x03,0x0b,0xff,0x20,0x00,0x03,0x0b,0x87,0x40,0x00,0xff,0x00,0x01,
  1238. 0x80,0x00,0x03,0x0b,0xff,0x20,0x00,0x03,0x0b,0x33,0x40,0x00,0x03,0x04,0x00,
  1239. 0x80,0x00,0x03,0x0b,0xff,0xa0,0x00,0x03,0x0b,0x33,0xc0,0x00,0x00,0x04,0xfe,
  1240. 0x00,0x03,0x0b,0xff,0x20,0x00,0x03,0x0b,0x03,0x40,0x00,0x03,0x04,0x00,0x80,
  1241. 0x00,0x03,0x0b,0xff,0xa0,0x00,0x03,0x0b,0xff,0xc0,0x00,0x00,0x04,0xfe,0x00,
  1242. 0x03,0x0f,0xff,0xa0,0x00,0x03,0x0f,0xff,0xc0,0x00,0xfd,0x00,0x03,0x0f,0xff,
  1243. 0xc0,0x00,0x00,0x08,0xfe,0x00,0xfd,0x00, },
  1244. { /* 13 */
  1245. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x03,0x60,0x18,0x0c,0x00,0x03,0x00,0x38,0x00,
  1246. 0x00,0x03,0x60,0x18,0x0c,0x00,0x03,0x20,0x28,0x04,0x00,0x03,0x60,0x18,0x0c,
  1247. 0x00,0xff,0x20,0x01,0x06,0x00,0x03,0xf0,0x38,0x14,0x00,0x03,0x42,0x08,0x84,
  1248. 0x00,0x03,0xe0,0x20,0x0a,0x00,0x03,0x59,0x0d,0xec,0x00,0x03,0x30,0x1c,0x1c,
  1249. 0x00,0x03,0x40,0x00,0x82,0x00,0x03,0x1c,0xb6,0x4c,0x00,0x03,0x2a,0x15,0x24,
  1250. 0x00,0x03,0x11,0x38,0x82,0x00,0x03,0x26,0x4c,0xdc,0x00,0x03,0x35,0x2a,0x54,
  1251. 0x00,0x03,0x28,0x91,0x40,0x00,0x03,0x2b,0x3d,0x98,0x00,0x03,0x12,0x3d,0x90,
  1252. 0x00,0x03,0x28,0xa2,0xa4,0x00,0x03,0x15,0xb7,0x38,0x00,0x03,0x1f,0xd2,0x68,
  1253. 0x00,0x03,0x10,0x35,0x04,0x00,0x03,0x12,0x6c,0xf8,0x00,0x03,0x0a,0xba,0x68,
  1254. 0x00,0x03,0x12,0x64,0xc4,0x00,0x03,0x06,0x9c,0xb0,0x00,0x03,0x09,0x79,0x20,
  1255. 0x00,0x03,0x06,0x98,0x88,0x00,0x03,0x09,0x89,0x70,0x00,0x03,0x0d,0x91,0x50,
  1256. 0x00,0x03,0x08,0x02,0x88,0x00,0x03,0x0a,0xba,0xf0,0x00,0x03,0x05,0x4d,0x10,
  1257. 0x00,0x03,0x08,0x10,0x40,0x00,0x03,0x03,0x9e,0xe0,0x00,0x03,0x06,0x1c,0x00,
  1258. 0x00,0x03,0x03,0xe1,0x10,0x00,0x03,0x03,0xff,0xe0,0x00,0x03,0x03,0xff,0xe0,
  1259. 0x00,0xff,0x00,0x01,0x10,0x00, },
  1260. { /* 14 */
  1261. 0xfd,0x00,0xfd,0x00,0xfd,0x00,0x00,0x60,0xfe,0x00,0x00,0x20,0xfe,0x00,0x00,
  1262. 0x10,0xfe,0x00,0x00,0x98,0xfe,0x00,0x00,0xf8,0xfe,0x00,0x00,0x04,0xfe,0x00,
  1263. 0x00,0x6f,0xfe,0x00,0x00,0x51,0xfe,0x00,0x03,0x20,0x80,0x00,0x00,0x03,0x3f,
  1264. 0xc0,0x00,0x00,0x03,0x24,0x40,0x00,0x00,0x03,0x00,0x20,0x00,0x00,0x03,0x0f,
  1265. 0xf8,0x00,0x00,0x03,0x01,0x18,0x00,0x00,0xfd,0x00,0x03,0x07,0x7e,0x00,0x00,
  1266. 0x03,0x04,0x06,0x00,0x00,0x03,0x00,0x80,0x00,0x00,0x03,0x01,0xdf,0x80,0x00,
  1267. 0x03,0x01,0x40,0x80,0x00,0x03,0x02,0x20,0x00,0x00,0x03,0x00,0x67,0x60,0x00,
  1268. 0x03,0x00,0x05,0x20,0x00,0x03,0x00,0x98,0x90,0x00,0x03,0x00,0x3e,0xd8,0x00,
  1269. 0x03,0x00,0x2b,0x40,0x00,0x03,0x00,0x04,0xe0,0x00,0x03,0x00,0x0c,0x4c,0x00,
  1270. 0x03,0x00,0x09,0x90,0x00,0x03,0x00,0x12,0x68,0x00,0x03,0x00,0x06,0x04,0x00,
  1271. 0x03,0x00,0x06,0xb8,0x00,0x03,0x00,0x01,0x42,0x00,0x03,0x00,0x01,0xc4,0x00,
  1272. 0x03,0x00,0x01,0x70,0x00,0x03,0x00,0x02,0x0a,0x00,0xff,0x00,0x01,0x78,0x00,
  1273. 0xff,0x00,0x01,0x60,0x00,0xff,0x00,0x01,0x86,0x00,0xfd,0x00,0xfd,0x00,0xff,
  1274. 0x00,0x01,0x3e,0x00, },
  1275. };
  1276. ///
  1277. /// CO_New
  1278. //  Creates configuration window
  1279. enum { CMEN_OPEN = 1201, CMEN_SAVEAS, CMEN_DEF, CMEN_DEFALL, CMEN_LAST, CMEN_REST, CMEN_MIME };
  1280.  
  1281. struct CO_ClassData *CO_New(void)
  1282. {
  1283.    struct CO_ClassData *data;
  1284.  
  1285.    if (data = calloc(1,sizeof(struct CO_ClassData)))
  1286.    {
  1287.       static struct PageList page[MAXCPAGES], *pages[MAXCPAGES+1];
  1288.       APTR lv;
  1289.       int i;
  1290.       for (i = 0; i < MAXCPAGES; i++) { page[i].Offset = i; pages[i] = &page[i]; }
  1291.       pages[i] = NULL;
  1292.       page[ 0].Label = MSG_CO_CrdFirstSteps;
  1293.       page[ 1].Label = MSG_CO_CrdTCPIP;
  1294.       page[ 2].Label = MSG_CO_CrdNewMail;
  1295.       page[ 3].Label = MSG_CO_CrdFilters;
  1296.       page[ 4].Label = MSG_CO_CrdRead;
  1297.       page[ 5].Label = MSG_CO_CrdWrite;
  1298.       page[ 6].Label = MSG_CO_CrdReply;
  1299.       page[ 7].Label = MSG_CO_CrdSignature;
  1300.       page[ 8].Label = MSG_CO_CrdLists;
  1301.       page[ 9].Label = MSG_CO_CrdSecurity;
  1302.       page[10].Label = MSG_CO_CrdStartQuit;
  1303.       page[11].Label = MSG_CO_CrdMIME;
  1304.       page[12].Label = MSG_CO_CrdABook;
  1305.       page[13].Label = MSG_CO_CrdScripts;
  1306.       page[14].Label = MSG_CO_CrdMixed;
  1307.       data->GUI.WI = WindowObject,
  1308.          MUIA_Window_Title, GetStr(MSG_MA_MConfig),
  1309.          MUIA_HelpNode,"CO_W",
  1310.          MUIA_Window_Menustrip, MenustripObject,
  1311.             MUIA_Family_Child, MenuObject, MUIA_Menu_Title, GetStr(MSG_MA_Project),
  1312.                MUIA_Family_Child, MenuitemObject, MUIA_Menuitem_Title,GetStr(MSG_CO_Open), MUIA_Menuitem_Shortcut,"O", MUIA_UserData,CMEN_OPEN, End,
  1313.                MUIA_Family_Child, MenuitemObject, MUIA_Menuitem_Title,GetStr(MSG_CO_SaveAs), MUIA_Menuitem_Shortcut,"A", MUIA_UserData,CMEN_SAVEAS, End,
  1314.             End,
  1315.             MUIA_Family_Child, MenuObject, MUIA_Menu_Title, GetStr(MSG_CO_Edit),
  1316.                MUIA_Family_Child, MenuitemObject, MUIA_Menuitem_Title,GetStr(MSG_CO_ResetDefaults), MUIA_Menuitem_Shortcut,"D", MUIA_UserData,CMEN_DEF, End,
  1317.                MUIA_Family_Child, MenuitemObject, MUIA_Menuitem_Title,GetStr(MSG_CO_ResetAll), MUIA_Menuitem_Shortcut,"E", MUIA_UserData,CMEN_DEFALL, End,
  1318.                MUIA_Family_Child, MenuitemObject, MUIA_Menuitem_Title,GetStr(MSG_CO_LastSaved), MUIA_Menuitem_Shortcut,"L", MUIA_UserData,CMEN_LAST, End,
  1319.                MUIA_Family_Child, MenuitemObject, MUIA_Menuitem_Title,GetStr(MSG_CO_Restore), MUIA_Menuitem_Shortcut,"R", MUIA_UserData,CMEN_REST, End,
  1320.             End,
  1321.             MUIA_Family_Child, MenuObject, MUIA_Menu_Title, GetStr(MSG_CO_Extras),
  1322.                MUIA_Family_Child, data->GUI.MI_IMPMIME = MenuitemObject, MUIA_Menuitem_Enabled,FALSE, MUIA_Menuitem_Title,GetStr(MSG_CO_ImportMIME), MUIA_UserData,CMEN_MIME, End,
  1323.             End,
  1324.          End,
  1325.          MUIA_Window_ID, MAKE_ID('C','O','N','F'),
  1326.          WindowContents, VGroup,
  1327.             Child, HGroup,
  1328.                Child, lv = ListviewObject,
  1329.                   MUIA_CycleChain,1,
  1330.                   MUIA_Listview_List, data->GUI.LV_PAGE = NewObject(CL_PageList->mcc_Class,NULL,
  1331.                      InputListFrame,
  1332.                      MUIA_List_AdjustWidth, TRUE,
  1333.                      MUIA_List_MinLineHeight, 16,
  1334.                      MUIA_List_SourceArray, pages,
  1335.                      MUIA_List_Active, 0,
  1336.                   End,
  1337.                End,
  1338.                Child, data->GUI.GR_PAGE = VGroup,
  1339.                   TextFrame,
  1340.                   InnerSpacing(6,6),
  1341.                   MUIA_Background, MUII_PageBack,
  1342.                   Child, data->GUI.GR_SUBPAGE = CO_BuildPage(data, 0),
  1343.                End,
  1344.             End,
  1345.             Child, HGroup,
  1346.                MUIA_Group_SameWidth, TRUE,
  1347.                Child, data->GUI.BT_SAVE   = MakeButton(GetStr(MSG_CO_Save)),
  1348.                Child, data->GUI.BT_USE    = MakeButton(GetStr(MSG_CO_Use)),
  1349.                Child, data->GUI.BT_CANCEL = MakeButton(GetStr(MSG_CO_Cancel)),
  1350.             End,
  1351.          End,
  1352.       End;
  1353.       if (data->GUI.WI)
  1354.       {
  1355.          DoMethod(G->App, OM_ADDMEMBER, data->GUI.WI);
  1356.          set(data->GUI.WI, MUIA_Window_DefaultObject, lv);
  1357.          SetHelp(data->GUI.BT_SAVE,   MSG_HELP_CO_BT_SAVE);
  1358.          SetHelp(data->GUI.BT_USE,    MSG_HELP_CO_BT_USE);
  1359.          SetHelp(data->GUI.BT_CANCEL, MSG_HELP_CO_BT_CANCEL);
  1360.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_MenuAction  ,CMEN_OPEN     ,MUIV_Notify_Application,2,MUIM_CallHook,&CO_OpenConfigHook);
  1361.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_MenuAction  ,CMEN_SAVEAS   ,MUIV_Notify_Application,2,MUIM_CallHook,&CO_SaveConfigAsHook);
  1362.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_MenuAction  ,CMEN_DEF      ,MUIV_Notify_Application,3,MUIM_CallHook,&CO_ResetToDefaultHook,FALSE);
  1363.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_MenuAction  ,CMEN_DEFALL   ,MUIV_Notify_Application,3,MUIM_CallHook,&CO_ResetToDefaultHook,TRUE);
  1364.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_MenuAction  ,CMEN_LAST     ,MUIV_Notify_Application,2,MUIM_CallHook,&CO_LastSavedHook);
  1365.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_MenuAction  ,CMEN_REST     ,MUIV_Notify_Application,2,MUIM_CallHook,&CO_RestoreHook);
  1366.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_MenuAction  ,CMEN_MIME     ,MUIV_Notify_Application,3,MUIM_CallHook,&CO_ImportCTypesHook,FALSE);
  1367.          DoMethod(data->GUI.LV_PAGE     ,MUIM_Notify,MUIA_List_Active        ,MUIV_EveryTime,MUIV_Notify_Application,3,MUIM_CallHook,&CO_ChangePageHook,MUIV_TriggerValue);
  1368.          DoMethod(data->GUI.BT_SAVE     ,MUIM_Notify,MUIA_Pressed            ,FALSE         ,MUIV_Notify_Application,3,MUIM_CallHook,&CO_CloseHook,2);
  1369.          DoMethod(data->GUI.BT_USE      ,MUIM_Notify,MUIA_Pressed            ,FALSE         ,MUIV_Notify_Application,3,MUIM_CallHook,&CO_CloseHook,1);
  1370.          DoMethod(data->GUI.BT_CANCEL   ,MUIM_Notify,MUIA_Pressed            ,FALSE         ,MUIV_Notify_Application,3,MUIM_CallHook,&CO_CloseHook,0);
  1371.          DoMethod(data->GUI.WI          ,MUIM_Notify,MUIA_Window_CloseRequest,TRUE          ,MUIV_Notify_Application,3,MUIM_CallHook,&CO_CloseHook,0);
  1372.          return data;
  1373.       }
  1374.       free(data);
  1375.    }
  1376.    return NULL;
  1377. }  
  1378. ////
  1379.